


def bin2hex(in_file,out_file):
    def read_file():
        with open(in_file,'rb') as fp:
            while True:
                y=fp.read(1)
                if y == b'':
                    break
                yield '%02x\n' % ord(y)
                #~ print(repr(y),hex(ord(y)))
    with open(out_file,'w') as fp:
        for i in read_file():
            fp.write(i)
def main(args):
    bin2hex(args[1],args[2])
    return 0
if __name__ == '__main__':
    import sys
    sys.exit(main(sys.argv))
